package com.example.patient.controller;

import com.example.common.support.Result;
import com.example.patient.dto.req.DoFollowrReq;
import com.example.patient.dto.req.MyFollowrDetailReq;
import com.example.patient.dto.req.WcJsapiTicketReq;
import com.example.patient.dto.resp.*;
import com.example.patient.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wxy
 * @Date 2021/1/18 11:43
 * @Version 1.0
 */
@RestController
@Api(tags = "首页")
@RequestMapping("/api/Home")
public class HomeController {
    @Resource
    private HomeService homeService;

    @ApiOperation(value = "首页信息", notes = "首页信息")
    @PostMapping(value = "/IndexData")
    public Result<IndexDataResp> IndexData() {
        return Result.success(homeService.IndexData());
    }

    @ApiOperation(value = "医院公告列表", notes = "医院公告列表")
    @PostMapping(value = "/NoticeList")
    public Result<List<NoticeListResp>> NoticeList() {
        return Result.success(homeService.NoticeList());
    }

    @ApiOperation(value = "执业信息", notes = "执业信息")
    @PostMapping(value = "/HospitalInfo")
    public Result<HospitalInfoResp> HospitalInfo() {
        return Result.success(homeService.HospitalInfo());
    }

    @ApiOperation(value = "科室", notes = "科室")
    @PostMapping(value = "/DepList")
    public Result<DepListResp> DepList() {
        return Result.success(homeService.DepList());
    }

    @ApiOperation(value = "随访列表", notes = "随访列表")
    @PostMapping(value = "/MyFollowrList")
    public Result<List<MyFollowrListResp>> MyFollowrList() {
        return Result.success(homeService.MyFollowrList());
    }

    @ApiOperation(value = "随访详情", notes = "随访详情")
    @PostMapping(value = "/MyFollowrDetail")
    public Result<MyFollowrDetailResp> MyFollowrDetail(@RequestBody MyFollowrDetailReq req) {
        return Result.success(homeService.MyFollowrDetail(req));
    }

    @ApiOperation(value = "完成随访", notes = "完成随访")
    @PostMapping(value = "/DoFollowr")
    public Result<DoFollowrResp> DoFollowr(@RequestBody List<DoFollowrReq> reqList) {
        return Result.success(homeService.DoFollowr(reqList));
    }

    @ApiOperation(value = "微信JsTicket签名", notes = "微信JsTicket签名")
    @PostMapping(value = "/WcJsapiTicket")
    public Result<Object> WcJsapiTicket(@RequestBody WcJsapiTicketReq req) {
        return Result.success(homeService.WcJsapiTicket(req));
    }
}
